package xiao_jin.fantastic_journey.core.common.block.relictechentity;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.util.math.Direction;

import java.util.Objects;

import static net.minecraft.state.property.Properties.HORIZONTAL_AXIS;

// TODO
public class RelictechOrbitStoneBlock extends Block {
    public static final BooleanProperty ACTIVATION = BooleanProperty.of("activation");

    public RelictechOrbitStoneBlock(Settings settings) {
        super(settings);
        setDefaultState(getDefaultState()
                .with(ACTIVATION, false)
                .with(HORIZONTAL_AXIS, Direction.Axis.X)
        );
    }

    @Override
    protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
        builder.add(HORIZONTAL_AXIS).add(ACTIVATION);
    }

    //  获取放置状态
    @Override
    public BlockState getPlacementState(ItemPlacementContext ctx) {
        return Objects.requireNonNull(super.getPlacementState(ctx))
                .with(HORIZONTAL_AXIS, ctx.getHorizontalPlayerFacing().getAxis());
    }
}